/*
 * Team Huskies:
 * Aakanksha Gaur,
 * Alice Robinson,
 * Paul Winters,
 * Steve Bradshaw
 * Date: June 8th 2011
 */
#ifndef QUEUE_H
#define QUEUE_H

typedef void *qelem_t;

typedef struct qnode
{
        qelem_t elem;
        struct qnode *next;
        struct qnode *prev;
}qnode;

typedef struct
{
        qnode *back;
        qnode *front;
        int size;
}queue;

/*
 * Create an queue.
 */
queue *q_create(void);

/*
 * Destroy an queue.
 * Returns 1 on success, and otherwise 0.
 */
int q_destroy(queue *q);

/*
 * Check if queue is empty.
 * Returns 1 if the queue is empty, and otherwise 0.
 */
int q_isempty(queue *q);

/*
 * Add element to queue.
 * Returns 1 on success, and otherwise 0.
 */
int q_enqueue(queue *q, qelem_t elem);

/*
 * Remove element from queue, and return it.
 */
qelem_t q_dequeue(queue *q);

#endif /* QUEUE_H */
